# 使用opoen
# a = open('111.txt','r',encoding='utf-8')
# print(a.read())
# 使用with
# # with open('2222.txt','r',encoding='utf-8') as file:
# #     text = file.read()
# # print(text)
# # # 绝对路径
# # b=open('C:\Users\Administrator\Desktop/333.txt','r',encoding='utf-8')
# # print(b.read())
#
# # 写文件write()
# import pandas
# import pandas as pd
#
# aa = open('555.txt' , 'w', encoding='utf-8')
# aa.write('niubi666')
# aa.close()
#
# data = '中国你好'
# with open('555.txt', 'a', encoding='utf-8') as f:
#     f.write(data)

# import math
# 处理Excel文件时候用pands
# 读取excel表数据
import pandas as pd
dd =pd.read_excel(r'C:\Users\Administrator\Desktop\111.xlsx')
print(dd)

# 写文件到excle
a1={'name':'xiaohong','age':22}
a2={'name':'xiaoliu','age':21}
a3={'name':'xiaobai','age':22}
l=[a1,a2,a3]
print(l)
# 需要将列表变成DATAframe格式
df1=pd.DataFrame(l)
print(df1)
# 使用pands函数to-exc（）
df1.to_excel('222.xlsl',index=False)
